package com.leyou.controller;

import com.leyou.service.PageService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;

import java.util.Map;

/**
 * @author Eric
 * @version v1.0
 * @package com.leyou.controller
 * @date 2019/7/3 15:49
 * @description:
 **/
@Controller
public class PageController {


    @Autowired
    private PageService pageService;

    /**
     * 商品详情展示的查询
     * @param model
     * @param spuId
     * @return
     */
    @GetMapping("item/{id}.html")
    public String toItemPage(Model model, @PathVariable("id") Long spuId){

        Map<String,Object> itemDate =pageService.loadDate(spuId);

        model.addAllAttributes(itemDate);

        return "item";
    }

}
